package com.example.messagemodule.adapter;

import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.messagemodule.R;
import com.example.messagemodule.entity.GuideVideoEntity;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by SHICHENG
 * <p>
 * Time on 2022/01/10
 */
public class GuideAdapter extends BaseQuickAdapter<GuideVideoEntity.DataBean, BaseViewHolder> {

    public int p = 0;

    public GuideAdapter( @Nullable List<GuideVideoEntity.DataBean> data) {
        super(R.layout.item_guide_video_layout, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, GuideVideoEntity.DataBean item) {
        Glide.with(mContext).load(item.getImageUrl()).into((ImageView) helper.getView(R.id.guide_video_item_img));
        helper.setText(R.id.guide_video_item_name,item.getTitle());
        if (p  == helper.getPosition()){
            helper.setTextColor(R.id.guide_video_item_name,mContext.getResources().getColor(R.color.new_theme));
            Glide.with(mContext).load(mContext.getResources().getDrawable(R.mipmap.videoplayer_play1)).into((ImageView) helper.getView(R.id.guide_video_item_plyer));
        }else{
            helper.setTextColor(R.id.guide_video_item_name,mContext.getResources().getColor(R.color.color_1A1A1A));
            Glide.with(mContext).load(mContext.getResources().getDrawable(R.mipmap.videoplayer_pause1)).into((ImageView) helper.getView(R.id.guide_video_item_plyer));
        }

    }

    @Override
    public void setOnItemChildClickListener(OnItemChildClickListener listener) {
        super.setOnItemChildClickListener(listener);
    }
}
